<template>
  <view :style="themeColor">
    <view class="page">
      <view class="flex benben-position-layout flex flex-wrap align-center kaoqindaka_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-center justify-between flex-sub kaoqindaka_fd0_0'>
          <view class='flex flex-wrap align-center kaoqindaka_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
            data-url="1">
            <text class='fu-iconfont2  kaoqindaka_fd0_0_c0_c0'>&#xE794;</text>
          </view>
          <view class='flex flex-wrap align-stretch justify-center'>
            <text class='kaoqindaka_fd0_0_c1_c0'>考勤打卡</text>
          </view>
          <view class='flex flex-wrap align-center justify-end kaoqindaka_fd0_0_c0'>
          </view>
        </view>

      </view>
      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
      <!---flex布局flex布局开始-->
      <view class="flex flex-wrap align-center justify-between benben-flex-layout kaoqindaka_flex_1">
        <view class='flex flex-direction align-stretch kaoqindaka_fd1_0'>
          <text class='kaoqindaka_fd1_0_c0'>上班{{info.up_time}}</text>
          <text class='kaoqindaka_fd1_0_c1'
            :class="info.up_flag ? 'active' : ''">{{info.up_flag ? '已打卡' : '未打卡'}}</text>
        </view>
        <view class='flex flex-direction align-stretch kaoqindaka_fd1_0'>
          <text class='kaoqindaka_fd1_0_c0'>下班{{info.down_time}}</text>
          <text class='kaoqindaka_fd1_0_c1'
            :class="info.down_flag ? 'active' : ''">{{info.down_flag ? '已打卡' : '未打卡'}}</text>
        </view>
      </view>

      <!---flex布局flex布局结束-->
      <!---flex布局flex布局开始-->
      <!--   <view class="flex flex-wrap align-center justify-center benben-flex-layout kaoqindaka_flex_2" @click="dakalist">
        <view class='flex flex-direction flex-wrap align-center justify-center kaoqindaka_fd2_0'>
          <text class='kaoqindaka_fd2_0_c0'>{{!info.up_flag ? '上班打卡' : '下班打卡'}}</text> -->
      <!-- <text class='kaoqindaka_fd2_0_c1'>8:25:35</text>
           -->
      <h-time-roll @change="change" class="kaoqindaka_fd2_0_c1" ref="timeRoll"></h-time-roll>
      <view class="text-333 text-df " style="text-align: center;">{{suozaiweizhi}}</view>
      <!--        </view>
      </view> -->

      <!---flex布局flex布局结束-->


    </view>
  </view>
</template>
<script>
  export default {
    components: {},


    data() {
      return {
        riqi: '',
        info: "",
        shengfen: '',
        chengshi: '',
        diqu: '',
        suozaiweizhi: ''
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {
      var timeStamp = new Date();
      this.riqi = this.$util.timeFormat(timeStamp)
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {
      let _this = this
      uni.getLocation({
        type: 'wgs84',
        success: function(res) {
          console.log('当前位置的经度：' + res.longitude);
          console.log('当前位置的纬度：' + res.latitude);
          _this.$api.post(global.apiUrls.post6629e9db2f87d, {
            location: res.longitude + ',' + res.latitude,
          }).then(res => {
            if (res.data.code == 1) {
              _this.shengfen = res.data.data.all.province
              _this.chengshi = res.data.data.all.city
              _this.diqu = res.data.data.all.district
              _this.suozaiweizhi = _this.shengfen + _this.chengshi + _this.diqu + res.data.data.all.township
              console.log(' this.suozaiweizhi', this.suozaiweizhi)
            }
          })
        }
      });
      this.getData()
    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {

    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      dakalist() {
        console.log('ppppp')
      },
      change(e) {
        console.log('eeeeee', e)
        let shangbandakashijian = ''
        let xiabandakashijian = ''
        let dakazhuangtai = ''
        if (!this.info.up_flag) {
          shangbandakashijian = e.time
          dakazhuangtai = '1'
        } else {
          xiabandakashijian = e.time
          dakazhuangtai = '2'
        }
        this.$api.post(global.apiUrls.post6628a3198c1bd, {
          riqi: this.riqi,
          shangbandakashijian: shangbandakashijian,
          xiabandakashijian: xiabandakashijian,
          dakazhuangtai: dakazhuangtai,
          dakadidian: this.suozaiweizhi,
        }).then(res => {
          if (res.data.code == 1) {
            this.getData()
          } else {
            this.$message.info(res.data.msg)
          }
        })
      },
      getData() {
        this.$api.post(global.apiUrls.post6628a388c4eba, {
          riqi: this.riqi
        }).then(res => {
          if (res.data.code == 1) {
            this.info = res.data.data
          }
        })
      }
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: #F8F8F8;
    background-size: 100% auto;
  }

  .kaoqindaka_flex_0 {
    background: #fff;
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .kaoqindaka_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 700;
    color: #333333;
    line-height: 50rpx;
  }

  .kaoqindaka_fd0_0_c0_c0 {
    font-size: 36rpx;
    color: #333;
  }

  .kaoqindaka_fd0_0_c0 {
    width: 120rpx;
  }

  .kaoqindaka_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .kaoqindaka_flex_1 {
    width: 710rpx;
    margin: 24rpx auto 24rpx auto;
  }

  .kaoqindaka_fd1_0_c1 {
    color: #333;

    &.active {
      color: var(--benbenFontColor4);
    }

    margin: 12rpx 0rpx 0rpx 0rpx;
  }

  .kaoqindaka_fd1_0_c0 {
    font-weight: 600;
  }

  .kaoqindaka_fd1_0 {
    background: var(--benbenbgColor1);
    padding: 24rpx;
    border-radius: 16rpx;
    background-size: 100% auto;
    width: 332rpx;
  }

  .kaoqindaka_flex_2 {
    background: var(--benbenbgColor1);
    width: 710rpx;
    padding: 24rpx;
    margin: 0rpx auto 0rpx auto;
    background-size: 100% auto;
    border-radius: 16rpx;
    height: 1000rpx;
  }

  .kaoqindaka_fd2_0_c1 {
    font-size: 32rpx;
    margin: 12rpx 0rpx 0rpx 0rpx;
  }

  .kaoqindaka_fd2_0_c0 {
    font-size: 36rpx;
  }

  .kaoqindaka_fd2_0 {
    background: url(image-path('154.png')) no-repeat;
    background-size: 100% 100%;
    width: 381rpx;
    height: 381rpx;
    color: var(--benbenFontColor3);
  }
</style>
